package com.gdkm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.gdkm.po.Prescription;
@Repository
@Mapper
public interface PrescriptionDao {
	 @Insert("insert into prescription_management(pr_number,pr_name,pr_doctor,pr_method, pr_type,total_amount,fees,re_fess,charge_time,options,symptom,yn_charge) "
		 		+ "values(#{pr_number},#{pr_name},#{pr_doctor},#{pr_method},#{pr_type},#{total_amount},#{fees},#{re_fess},#{charge_time},#{options},#{symptom},#{yn_charge})")
		 void save1(String pr_number, String pr_name,String pr_doctor,String pr_method,String pr_type, String total_amount,String fees,String re_fess,String charge_time, String options,String symptom,String yn_charge );
	
	
	@Select("SELECT * FROM prescription_management WHERE pr_number LIKE concat('%',#{pr_number},'%') && pr_name LIKE concat('%',#{pr_name},'%') limit #{y},#{ge}")
	List<Prescription> list3(String pr_number,String pr_name,int y,int ge);
	
	 @Select("SELECT * FROM prescription_management  limit #{y},#{ge}")
	 List<Prescription> list2(int y,int ge);
	 @Update("UPDATE  prescription_management set pr_number=#{pr_number},pr_name=#{pr_name},pr_doctor=#{pr_doctor},pr_method=#{pr_method}, pr_type=#{pr_type},total_amount=#{total_amount},fees=#{fees},re_fess=#{re_fess}"
	 		+ ", charge_time=#{charge_time},options=#{options},symptom=#{symptom},yn_charge=#{yn_charge} where id=#{id}")
	 void update(Prescription stu);
	 @Delete("DELETE FROM prescription_management where id=#{id}")
		void delete1(int id);
}
